<template>
    <div class="layerRtb layerRtb-threecolumn layerRtb-right">
       <three-title :title="{name:'培训'}" :close="false">
        <span tag="i" class="rig_close fr" @click="$parent.$parent.clickFourShow()"></span>
    </three-title>
        <div class="layerRtb-scroll thinScroll" v-scrollHeight="437" >
            <div class="analyItem" >
                <p class="analyItemTit tx-center">开班</p>
                <div class="analyItemCon">
                    <p class="col-md-7">原因
                            <span class="cLightGray pr8">积分7月份、10月份未达标，参与培训。</span>
                    </p>
                    <p class="col-md-3">时间
                            <span class="cLightGray pr8"> 2020-01-19</span>
                    </p>
                    <p class="col-md-2">
                        <input type="button" value="推送" class="fr uiBtn-small uiBtn-blue">
                    </p>
                </div>
            </div>
        <div class="analyItem">
            <p class="analyItemTit tx-center">退回</p>
            <div class="analyItemCon">
                <p class="col-md-8">
                    <textarea rows="2" placeholder="输入备注" class="form-control item-remarks" style="width: 90%;"></textarea>
                </p>
                <p class="col-md-2 mt10">
                    <span class="cLightGray" title="退回，需要手动将积分补回到正常积分。">补分:</span>
                    <input type="text" class="width40 form-control" value="积分">
                </p>
                <p class="col-md-2 mt10">
                    <input type="button" value="退回" class="fr uiBtn-small uiBtn-red">
                </p>
            </div>
        </div>
        </div>
        <div class="layerRtb-footer">
             <div class="analyItem">
               <p class="analyItemTit tx-center">综合</p>
                   <div class="analyItemCon">
                        <p class="col-md-12">
                            <span>积分-</span>
                            <span>{{compluedTask}}</span>
                        </p>
                    </div>
            </div>
        </div>
    </div>
</template>
<script>
import { mapGetters } from 'vuex'
import { getDepositDetail } from '../../../Resources/Api/index'
export default {
    props: ['IntegralHandle'],
    data () {
        return {
            refundUser: [],
            dateValue: ''
        }
    },
    created () {
        this.GetDeposit()
    },
    methods: {
        GetDeposit () {
            let _this = this
            _this.refundUser = []
            getDepositDetail({
                uId: _this.leftInfo.uid,
                flag: 3, /* 退单 */
                cuurentMonth: this.$utils.format('yyyy-MM', this.dateValue)
            }).then(results => {
                _this.refundUser = results.data.Body
            }).catch(error => {
                console.log(error)
            })
        },
        dataChange () {
            this.GetDeposit()
        },
        clickFourShow (index) {
            this.fourIndex = index
        }
    },
    computed: {
        ...mapGetters(['leftInfo']),
        compluedTask () {
            return this.refundUser.map(item => item.pmIntegral).reduce((acc, cur) => (cur + acc), 0)
        }
    },
    watch: {
        leftInfo () {
            this.GetDeposit()
        }
    }
}
</script>
